import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '项目名称',
    align: "center",
    dataIndex: 'projectName_dictText'
  },
  {
    title: '项目编号',
    align: "center",
    dataIndex: 'projectId'
  },
  {
    title: '费用类型',
    align: "center",
    dataIndex: 'costType_dictText'
  },
  {
    title: '费用金额',
    align: "center",
    dataIndex: 'costMoney'
  },
  {
    title: '预期使用时间',
    align: "center",
    dataIndex: 'expectTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '负责人',
    align: "center",
    dataIndex: 'responsibilityPerson'
  },
  {
    title: '申请人',
    align: "center",
    dataIndex: 'applyPerson_dictText'
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'state',
    slots: { customRender: 'htmlSlot' },
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "项目名称",
    field: 'projectName',
    component: 'JDictSelectTag',
    componentProps:{
    },
    colProps: {span: 6},
  },
  {
    label: "状态",
    field: 'state',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '项目名称',
    field: 'projectName',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: ""
    },
  },
  {
    label: '费用类型',
    field: 'costType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: ""
    },
  },
  {
    label: '费用金额',
    field: 'costMoney',
    component: 'InputNumber',
  },
  {
    label: '预期使用时间',
    field: 'expectTime',
    component: 'DatePicker',
  },
  {
    label: '负责人',
    field: 'responsibilityPerson',
    component: 'Input',
  },
  {
    label: '申请人',
    field: 'applyPerson',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: ""
    },
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
